﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CPPEI.WorkflowCore
{
    /// <summary>
    /// 流程参与者集合
    /// </summary>
    public class ActorCollection
    {
        private List<Actor> _list;

        public ActorCollection()
        {
            _list = new List<Actor>();
        }

        public int Count
        {
            get
            {
                return _list.Count;
            }
        }

        public Actor this[int index]
        {
            get
            {
                return _list[index];
            }
        }

        public void Add(Actor actor)
        {
            _list.Add(actor);
        }

        public void Remove(Actor actor)
        {
            _list.Remove(actor);
        }

        public override string ToString()
        {
            StringBuilder builder = new StringBuilder();
            foreach (var actor in _list)
            {
                builder.AppendFormat("{0},", actor.Name);
            }
            return builder.ToString();
        }
    }
}
